package com.lebang.service.buss;

import com.lebang.entity.sys.LbbValidCode;
import com.lebang.example.LbbValidCodeExample;
import com.lebang.mapper.LbbValidCodeMapper;
import com.lebang.mapper.buss.ValidCodeMapper;
import com.lebang.model.enums.Booleans;
import com.lebangweb.common.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ValidCodeService {

    @Autowired
    private ValidCodeMapper validCodeMapper;
    @Autowired
    private LbbValidCodeMapper lbbValidCodeMapper;

    /**
     * 今日验证码是否已达上线
     *
     * @param phone
     * @return
     * @author weizx
     * @date 2018年7月24日 下午4:14:24
     */
    public int todayLimit(String appid, String phone, String type) {
        Date today1 = new Date();
        Date tomr = DateUtil.getAfterDate(today1, 1);
        String edate = DateUtil.dateToString(tomr , "yyyy-MM-dd");
        String sdate = DateUtil.dateToString(today1 , "yyyy-MM-dd");
        String category = "App";
        return validCodeMapper.limited(category, appid, phone, type, sdate, edate);
    }

    public int updateByPrimaryKeySelective(LbbValidCode lbbValidCode) {
        return lbbValidCodeMapper.updateByPrimaryKeySelective(lbbValidCode);
    }


}
